import React from 'react';
import ReactDom from 'react-dom';
import './petMarket.scss';
import { api } from 'js/api/api';
import Button from 'views/component/button/button';
import utils from 'js/core/utils';

class PetMarket extends React.Component {
    constructor() {
        super()
    }
    componentDidMount() {
    }
    select = (petId) => {
        api('bugPet', { petId: parseInt(petId) }, () => {

        })
    }
    render() {
        let petsConfig = window.totalConfig.pet;
        let node = [];
        for (let petId in petsConfig) {
            node.push(<div className="flex" key={petId}>
                <div> {petsConfig[petId].name}</div>
                <button onClick={() => { this.select(petId) }}>选择</button>
            </div>)
        }
        return <div id="petMarket" className="flex-col">
            {node}
        </div>
    }
}

export default PetMarket;